from flask import render_template
from app.backend import bp
from app.models import User, News
from flask_login import login_required, current_user


@bp.before_app_request
def befor_request():
    print('init ...')

@bp.route('/')
@bp.route('/index')
@login_required
def index():
    return render_template('backend/index.html')

@bp.route('/user')
@login_required
def user():
    model = User.query.all()
    return render_template('backend/user.html', model=model)

@bp.route('/news')
@login_required
def news():
    model = News.query.all()
    return render_template('backend/news.html', model=model)
